package cn.com.sinosoft.ares.insurance.dao;
import cn.com.sinosoft.ares.insurance.model.Temproom;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface TemproomDao {

    @Select("select * from temproom  where agentcode = #{agentcode} and orderid = #{orderid}")
    Temproom selectByagentcode(@Param("agentcode") String agentcode, @Param("orderid") String orderid);

    @Select("select * from temproom  where c_Ply_App_No = #{cPlyAppNo}")
    Temproom selectByAppNo(@Param("cPlyAppNo") String cPlyAppNo);

    @Insert("insert into temproom (agentcode,orderid,hotelorderno,transtime,personnumber," +
            "effecttime,expirytime,premium,contactperson,contactphone,idtype,idno,proposerpoiid," +
            "proposername,proposeraddress,insuredname,insuredpoiid,insuredaddress,c_Ply_No,c_Ply_App_No," +
            "usercode,password,agenttype,flag)" +
            "values" +
            "(#{agentcode},#{orderid},#{hotelorderno},#{transtime},#{personnumber}," +
            "#{effecttime},#{expirytime},#{premium},#{contactperson},#{contactphone},#{idtype},#{idno},#{proposerpoiid}" +
            ",#{proposername},#{proposeraddress},#{insuredname},#{insuredpoiid},#{insuredaddress},#{cPlyNo},#{cPlyAppNo}" +
            ",#{usercode},#{password},#{agenttype},#{flag})")
    void saveTemproom(Temproom temproom);

    @Update("update temproom set c_Ply_No = #{cPlyNo} " +
            "where agentcode = #{agentcode} and orderid = #{orderid}")
    int updateByPrimaryKey(Temproom temproom);

}
